<template>
	<view class="systemInfo">
		<view class="status_bar">
		  <!-- 这里是状态栏 -->
		</view>
		<u-navbar  title="系统消息"></u-navbar> 
		<view class="systemInfoBox">
			<view class="systemInfoList">
				<view class="systemInfoItem" v-for="(item,index) in list" :key="index">
					<view class="Infotime">{{item.create_time}}</view>
					<view class="InfoBox">
						<view class="InfoName">{{item.title}}</view>
						<view class="Infotext">{{item.content}}</view>
					</view>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				page:1,
				moreFlag:false,
				list:[]
			}
		},
		onLoad() {
      // #ifdef APP-PLUS
      var args = plus.runtime.arguments;
      if(args){
        app.$vm.setShareDetail(args);
      }
      // #endif
			this.getList();
		},
		onReachBottom() {
			if(!this.moreFlag){
				return false;
			}
			this.moreFlag = false;
			this.page = this.page + 1;
			this.getList();
		},
		onPageScroll(e){
			if(e.scrollTop<5&&this.moreFlag){
				this.moreFlag = false;
				this.page = this.page + 1;
				this.getList();
			}
		},
		methods: {
			setPageScrollTo(){
				this.$nextTick(()=>{
					uni.pageScrollTo({
					    scrollTop:999999999,	// -30 为多显示出大半个消息的高度，示意上面还有信息。
					    duration: 0
					});
				})
			},
			getList(){
				this.$u.api.noticeList().then(res=>{
					console.log(res)
					if(this.page == 1){
						this.list = res.data.list.data;
					}else{
						this.list = this.list.concat(res.data.list.data);
					}
					if(this.page < res.data.list.last_page){
						this.moreFlag = true;
					}else{
						this.moreFlag = false;
					}
				})
			}
		}
	}
</script>

<style scoped lang="less">
	.status_bar{
		height: var(--status-bar-height);
		width: 100%;
	}
.systemInfo{
	background-color: #F3F3F3;
	min-height: 100vh;
	overflow: auto;
	
	.systemInfoBox{
		padding: 120upx 24upx 32upx;
		.systemInfoList{
			display: flex;
			flex-direction: column-reverse;
			.systemInfoItem{
				margin-bottom: 48upx;
				.Infotime{
					font-size: 20upx;
					font-family: Source Han Sans CN;
					font-weight: 400;
					color: #D0D0D0;
					margin-bottom: 16upx;
					text-align: center;
				}
				.InfoBox{
					width: 702upx;
					// height: 118upx;
					background: rgba(250,250,250,0.8);
					border-radius: 8upx;
					padding: 24upx 30upx;
					.InfoName{
						font-size: 24upx;
						font-family: Source Han Sans CN;
						font-weight: 400;
						color: #333333;
					}
					.Infotext{
						font-size: 20upx;
						font-family: Source Han Sans CN;
						font-weight: 400;
						color: #666666;
						margin-top: 18upx;
					}
				}
			}
		}
	}
}
</style>
